package com.cqjtu.education.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/***
 * @title ExcelImport
 * @description <write your description>
 * @author 冉鹏
 * @create 2022/10/8 9:37
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ExcelTarget("学生账号批量导入模板")
public class ExcelImport implements Serializable, IExcelModel, IExcelDataModel {

    /**
     * 手机号正则校验
     */
    private static final String TEL_REGEXP = "^1[3-9]\\d{9}$";

    /**
     * 错误信息
     */
    private String errorMsg;

    /**
     * 错误行数
     */
    private int rowNum;

    /**
     * 学号
     */
    @NotNull(message = "不能为空")
    @Excel(name = "学号")
    private String identityId;

    /**
     * 手机号
     */
    @NotNull(message = "不能为空")
    @Pattern(regexp = TEL_REGEXP, message = "格式错误")
    @Excel(name = "手机号")
    private String tel;

    /**
     * 姓名
     */
    @NotNull(message = "不能为空")
    @Excel(name = "姓名")
    private String name;

    @Override
    public Integer getRowNum() {
        return this.rowNum;
    }

    @Override
    public void setRowNum(Integer integer) {
        this.rowNum = integer;
    }

    @Override
    public String getErrorMsg() {
        return this.errorMsg;
    }

    @Override
    public void setErrorMsg(String s) {
        this.errorMsg = s;
    }

}
